

<template>
  <div class="rightCZ" style="">
    <div>
      <el-tabs v-model="tabIndex" type="card" @tab-click="handleClick">
        <el-tab-pane label="长期医嘱" name="three">
          <div class="selects">
            <div class="selectTables" style="float: left">
              <el-popover placement="top-end" width="550px" trigger="focus">
                <el-input
                  size="mini"
                  placeholder="选择药品"
                  slot="reference"
                  v-model="selectParams.keyword"
                  @input="getDrugItem()"
                >
                  <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>
                <el-radio-group
                  v-model="isCollapse"
                  @change="hadejiancha"
                  style="margin-bottom: 20px"
                >
                  <el-radio-button :label="1">药品</el-radio-button>
                  <el-radio-button :label="8">项目</el-radio-button>
                  <!-- <el-radio-button :label="13">量表</el-radio-button> -->
                  <el-radio-button :label="12">组合项目</el-radio-button>
                  <!-- <el-radio-button :label="4">检查</el-radio-button>
                  <el-radio-button :label="3">检验</el-radio-button>
                  <el-radio-button :label="6">治疗</el-radio-button> -->
                  <el-radio-button :label="7">医嘱术语</el-radio-button>
                  <el-radio-button :label="11">常用</el-radio-button>
                  <el-radio-button :label="10">自带药</el-radio-button>
                </el-radio-group>
                <div
                  v-if="
                    isCollapse != 10 && isCollapse != 11 && isCollapse != 12
                  "
                >
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    @row-click="xuanzeDatathree"
                    :data="selectData.selectData1"
                 
                  >
                    <el-table-column label="序号" prop="id" width="50">
                    </el-table-column>

                    <el-table-column label="类型" prop="typename" width="50">
                    </el-table-column>
                    <el-table-column label="药品名称" prop="name" width="150">
                    </el-table-column>
                    <el-table-column label="价格" prop="price" width="50">
                    </el-table-column>
                    <el-table-column
                      label="规格"
                      prop="specification"
                      width="300"
                    >
                    </el-table-column>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else-if="isCollapse == 11">
                  <el-table
                    v-loading="threeSelectLoading"
                    height="300"
                    :data="selectData.selectData1"
                 
                  >
                    <template v-for="(item, index) in tableTitle11">
                      <el-table-column
                     
                        v-if="item.prop == 'id'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                     
                        v-if="item.prop == 'title'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                       
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatathree2(1, scope.row.extra_json)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else-if="isCollapse == 12">
                  <el-table
                    v-loading="threeSelectLoading"
                    height="300"
                    :data="selectData.selectData1"
                   
                  >
                    <template v-for="(item, index) in tableTitle11">
                      <el-table-column
                      
                        v-if="item.prop == 'id'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                    
                        v-if="item.prop == 'title'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                     
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatathree2(1, scope.row.extra_json)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else>
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    :data="selectData10"
                    style="width: 100%"
                  >
                    <template v-for="(item, index) in tableTitle10">
                      <el-table-column
                       
                        v-if="item.prop == 'name'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-input
                              v-model="scope.row.name"
                              size="mini"
                              placeholder="医嘱内容"
                            ></el-input>
                          </span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-input
                              v-model="scope.row.remark"
                              size="mini"
                              placeholder="备注"
                            ></el-input>
                          </span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatathree(scope.row)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                </div>
              </el-popover>
            </div>
            <div class="selectTables" style="float: left; margin-left: 20px">
              <el-input
                v-model="remark"
                size="mini"
                placeholder="备注"
              ></el-input>
            </div>

            <div class="yisheng">
              <el-popover placement="top-end" trigger="focus">
                <el-input
                  size="mini"
                  placeholder="处方医生"
                  slot="reference"
                  v-model="formusername2"
                  style="height: 40px"
                >
                  <!-- <i
                            slot="suffix"
                            class="iconfont icon-add-bai "
                            @click.stop="openUserInfo()"
                          ></i> -->
                </el-input>
                <el-table
                  @row-click="xuanzePatient2"
                  height="220"
                  :data="
                    duserlist.filter(
                      (data) =>
                        !formusername2 ||
                        data.real_name
                          .toLowerCase()
                          .includes(formusername2.toLowerCase())
                    )
                  "
                >
                  <el-table-column
                    width="100"
                    property="number"
                    label="序号"
                  ></el-table-column>

                  <el-table-column
                    width="150"
                    property="real_name"
                    label="姓名"
                  ></el-table-column>
                  <el-table-column
                    width="100"
                    property="dept_name"
                    label="科室"
                  ></el-table-column>

                  <el-table-column width="50" property="gender" label="性别">
                    <template slot-scope="scope">
                      {{
                        scope.row.gender == 1
                          ? "男"
                          : scope.row.gender == 2
                          ? "女"
                          : "未知"
                      }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-popover>
            </div>

            <el-button
              type="success"
              size="mini"
              @click="(yizhutongbu = true), getHospitalMember()"
              >同步医嘱</el-button
            >
             <el-button
              type="success"
              size="mini"
              @click="chengzu"
              >成组</el-button
            >
            <el-button
              type="success"
              size="mini"
              @click="quxiaochengzu"
              >取消成组</el-button
            >
          </div>
          <div>
            <el-table :data="tableData1" 
            @selection-change="handleSelectionChange2"
            ref="multipleTable"
            height="300" style="width: 100%">
               <el-table-column
      type="selection"
      width="55">
    </el-table-column>
              <template v-for="(item, index) in tableTitle">
               
                <el-table-column
                  fixed="left"
                  v-if="item.prop == 'id'"
                  type="index"
                  width="50"
                  :key="index"
                >
                </el-table-column>
            
                 
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'dose'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-input
                        v-model="scope.row.dose"
                        size="mini"
                        placeholder="剂量"
                        @input="zongliang(scope.row, index)"
                      ></el-input>
                    </span>
                  </template>
                </el-table-column>

                <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'fee_category_id'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.fee_category_id"
                        size="mini" placeholder="费用类型"
                        
                      >
                        <el-option
                          v-for="item in thatF.shoufeitype"
                          :key="item.name"
                          :label="item.name"
                          :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column> -->
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'base_unit'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.type == 1 ||scope.row.type == 10">
                      <el-select
                        v-model="scope.row.base_unit"
                        size="mini"
                        placeholder="基本单位"
                      >
                        <el-option
                          v-for="item in thatF.danwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                    <span v-else>
                      <el-select
                        v-model="scope.row.base_unit"
                        size="mini"
                        placeholder="基本单位"
                      >
                        <el-option
                          v-for="item in thatF.xiangmudanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'dose_unit'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.type == 1||scope.row.type == 10">
                      <el-select
                        v-model="scope.row.dose_unit"
                        size="mini"
                        placeholder="剂量单位"
                        style="width: 80px"
                      >
                        <el-option
                          v-for="item in thatF.zhijidanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                    <span v-else>
                      <el-select
                        v-model="scope.row.dose_unit"
                        size="mini"
                        placeholder="剂量单位"
                        style="width: 80px"
                      >
                        <el-option
                          v-for="item in thatF.xiangmudanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'start_time'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                   
                      <!-- <el-date-picker
                        v-model="scope.row.start_time"
                        type="datetime"
                        style="width: 160px"
                        size="mini"
                        placeholder="选择日期"
                        format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        @change="shijian2(scope.row.start_time)"
                      >
                      </el-date-picker> -->
                       <input type="datetime-local" style="width:150" step="01" 
                       @blur="shijian2(scope.row.start_time,scope.$index)"
                       @change="shijian2(scope.row.start_time,scope.$index)"
                         v-model="scope.row.start_time" />
                  
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'end_time'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-date-picker
                        v-model="scope.row.end_time"
                        type="datetime"
                        size="mini"
                        placeholder="选择日期"
                        style="width: 150px"
                        value-format="yyyy-MM-dd hh:mm"
                      >
                      </el-date-picker>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'each_dos'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.each_dos"
                        size="mini"
                        placeholder="频次"
                        @change="zongliang(scope.row, index)"
                      >
                        <el-option
                          v-for="item in thatF.pinci"
                          :key="item.name"
                          :label="item.name"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'usage'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.usage"
                        size="mini"
                        placeholder="用法"
                      >
                        <el-option
                          v-for="item in thatF.geiyao"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  v-else-if="item.prop == 'count'"
                  :width="item.width"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-input
                        v-model="scope.row.count"
                        size="mini"
                        placeholder="总量"
                        @blur="zongpicit(scope.row)"
                      ></el-input>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'is_skin_test'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-checkbox
                        v-model="scope.row.is_skin_test"
                        size="mini"
                      ></el-checkbox>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'trans_speed'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <span>
                        <el-select
                          v-model="scope.row.trans_speed"
                          size="mini"
                          placeholder="滴速"
                        >
                          <el-option
                            v-for="item in thatF.disu"
                            :key="item.name"
                            :label="item.name"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                      </span>
                    </span>
                  </template>
                </el-table-column>
                <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'department_name'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                  ref="myCascader"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-cascader
                        v-model="scope.row.department_name"
                        :options="thatF.departmentoptions"
                        :props="{ label: 'name', value: 'name' }"
                        style="width: 90%"
                        size="mini"
                        :show-all-levels="false"
                      ></el-cascader>
                    </span>
                  </template>
                </el-table-column> -->
                <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'usage_extra'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.usage_extra"
                        size="mini"
                        placeholder="西药脚注"
                      >
                        <el-option
                          v-for="item in thatF.xiyaojiaozhu"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column> -->

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'remark'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <span>
                        <el-input
                          v-model="scope.row.remark"
                          size="mini"
                          placeholder="备注"
                        ></el-input>
                      </span>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                </el-table-column>
              </template>

              <el-table-column fixed="right" label="操作" width="120">
                <template slot-scope="scope">
                  <el-button
                    @click.native.prevent="deleteRow(scope.$index, tableData1)"
                    type="text"
                    size="small"
                  >
                    移除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="临时医嘱" name="four">
          <div class="selects">
            <div class="selectTables" style="float: left">
              <el-popover placement="top-end" width="500px" trigger="focus">
                <el-input
                  size="mini"
                  placeholder="选择药品"
                  slot="reference"
                  v-model="selectParams.keyword"
                  @input="getDrugItem()"
                >
                  <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>
                <el-radio-group
                  v-model="isCollapse"
                  @change="hadejiancha"
                  style="margin-bottom: 20px"
                >
                  <el-radio-button :label="1">药品</el-radio-button>
                  <el-radio-button :label="8">项目</el-radio-button>
                  <!-- <el-radio-button :label="13">量表</el-radio-button> -->
                  <el-radio-button :label="12">组合项目</el-radio-button>
                  <!-- <el-radio-button :label="4">检查</el-radio-button>
                  <el-radio-button :label="3">检验</el-radio-button>
                  <el-radio-button :label="6">治疗</el-radio-button> -->
                  <el-radio-button :label="7">医嘱术语</el-radio-button>
                  <!-- <el-radio-button :label="5">手术</el-radio-button> -->
                  <el-radio-button :label="11">常用</el-radio-button>
                   <el-radio-button :label="10">自带药</el-radio-button>
                  <el-radio-button :label="9">出院带药</el-radio-button>

                </el-radio-group>
                <div
                  v-if="
                    isCollapse != 10 && isCollapse != 11 && isCollapse != 12
                  "
                >
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    @row-click="xuanzeDatafour"
                    :data="selectData.selectData1"
                    style="width: 100%"
                  >
                    <el-table-column label="序号" prop="id" width="50">
                    </el-table-column>

                    <el-table-column label="类型" prop="typename" width="50">
                    </el-table-column>
                    <el-table-column label="药品名称" prop="name" width="150">
                    </el-table-column>
                    <el-table-column label="价格" prop="price" width="50">
                    </el-table-column>
                    <el-table-column
                      label="规格"
                      prop="specification"
                      width="300"
                    >
                    </el-table-column>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else-if="isCollapse == 11">
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    :data="selectData.selectData1"
                    style="width: 100%"
                  >
                    <template v-for="(item, index) in tableTitle11">
                      <el-table-column
                       
                        v-if="item.prop == 'id'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                    
                        v-if="item.prop == 'title'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                       
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatathree2(2, scope.row.extra_json)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else-if="isCollapse == 12">
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    :data="selectData.selectData1"
                    style="width: 100%"
                  >
                    <template v-for="(item, index) in tableTitle11">
                      <el-table-column
                        
                        v-if="item.prop == 'id'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                        
                        v-if="item.prop == 'title'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                       
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatathree2(2, scope.row.extra_json)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </div>
                <div v-else>
                  <el-table
                    v-loading="threeSelectLoading"
                    height="220"
                    :data="selectData10"
                    style="width: 100%"
                  >
                    <template v-for="(item, index) in tableTitle10">
                      <el-table-column
                        
                        v-if="item.prop == 'name'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-input
                              v-model="scope.row.name"
                              size="mini"
                              placeholder="医嘱内容"
                            ></el-input>
                          </span>
                        </template>
                      </el-table-column>
                      <el-table-column
                       
                        v-else-if="item.prop == 'remark'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-input
                              v-model="scope.row.remark"
                              size="mini"
                              placeholder="备注"
                            ></el-input>
                          </span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        v-else-if="item.prop == 'caozuo'"
                        :prop="item.prop"
                        :fixed="item.left"
                        :label="item.label"
                        :key="index"
                      >
                        <template slot-scope="scope">
                          <span>
                            <el-button
                              type="success"
                              @click="xuanzeDatafour(scope.row)"
                              >添加</el-button
                            >
                          </span>
                        </template>
                      </el-table-column>
                    </template>
                  </el-table>
                </div>
              </el-popover>
            </div>
            <div class="selectTables" style="float: left; margin-left: 20px">
              <el-input
                v-model="remark"
                size="mini"
                placeholder="备注"
              ></el-input>
            </div>
            <div class="yisheng">
              <el-popover placement="top-end" trigger="focus">
                <el-input
                  size="mini"
                  placeholder="处方医生"
                  slot="reference"
                  v-model="formusername2"
                  style="height: 40px"
                >
                  <!-- <i
                            slot="suffix"
                            class="iconfont icon-add-bai "
                            @click.stop="openUserInfo()"
                          ></i> -->
                </el-input>
                <el-table
                  @row-click="xuanzePatient2"
                  height="220"
                  :data="
                    duserlist.filter(
                      (data) =>
                        !formusername2 ||
                        data.real_name
                          .toLowerCase()
                          .includes(formusername2.toLowerCase())
                    )
                  "
                >
                  <el-table-column
                    width="100"
                    property="number"
                    label="序号"
                  ></el-table-column>

                  <el-table-column
                    width="150"
                    property="real_name"
                    label="姓名"
                  ></el-table-column>
                  <el-table-column
                    width="100"
                    property="dept_name"
                    label="科室"
                  ></el-table-column>

                  <el-table-column width="50" property="gender" label="性别">
                    <template slot-scope="scope">
                      {{
                        scope.row.gender == 1
                          ? "男"
                          : scope.row.gender == 2
                          ? "女"
                          : "未知"
                      }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-popover>
            </div>
            <el-button
              type="success"
              size="mini"
              @click="chengzu2"
              >成组</el-button
            >
            <el-button
              type="success"
              size="mini"
              @click="quxiaochengzu2"
              >取消成组</el-button
            >
          </div>
          <div>
            <el-table :data="tableData2" 
            ref="multipleTable2"
                @selection-change="handleSelectionChange3"
            height="300" style="width: 100%">
               <el-table-column
      type="selection"
      width="55">
    </el-table-column>
              <template v-for="(item, index) in tableTitle">
           
                <el-table-column
                  :width="item.width"
                  v-if="item.prop == 'dose'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-input
                        v-model="scope.row.dose"
                        size="mini"
                        placeholder="剂量"
                        @input="zongliang(scope.row, index)"
                      ></el-input>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'base_unit'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.type == 1||scope.row.type == 10">
                      <el-select
                        v-model="scope.row.base_unit"
                        size="mini"
                        placeholder="基本单位"
                      >
                        <el-option
                          v-for="item in thatF.danwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                    <span v-else>
                      <el-select
                        v-model="scope.row.base_unit"
                        size="mini"
                        placeholder="基本单位"
                      >
                        <el-option
                          v-for="item in thatF.xiangmudanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'dose_unit'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.type == 1||scope.row.type == 10">
                      <el-select
                        v-model="scope.row.dose_unit"
                        size="mini"
                        placeholder="剂量单位"
                        style="width: 80px"
                      >
                        <el-option
                          v-for="item in thatF.zhijidanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                    <span v-else>
                      <el-select
                        v-model="scope.row.dose_unit"
                        size="mini"
                        placeholder="剂量单位"
                        style="width: 80px"
                      >
                        <el-option
                          v-for="item in thatF.xiangmudanwei"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'start_time'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <!-- <el-date-picker
                        v-model="scope.row.start_time"
                        type="datetime"
                        size="mini"
                        placeholder="选择日期"
                        style="width: 150px"
                          format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        @change="shijian(scope.row.start_time)"

                      >
                      </el-date-picker> -->
                        <input type="datetime-local"  style="width:150" step="01" 
                        @blur=" shijian(scope.row.start_time,scope.$index)" 
                        @change="shijian(scope.row.start_time,scope.$index)"
                         v-model="scope.row.start_time" />
                         
                    </span>
                  </template>
                </el-table-column>
                <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'fee_category_id'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.fee_category_id"
                        size="mini" placeholder="费用类型"
                      >
                        <el-option
                          v-for="item in thatF.shoufeitype"
                          :key="item.name"
                          :label="item.name"
                          :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column> -->
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'end_time'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-date-picker
                        v-model="scope.row.end_time"
                        type="datetime"
                        size="mini"
                        placeholder="选择日期"
                        value-format="yyyy-MM-dd HH:mm"
                      >
                      </el-date-picker>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'each_dos'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.each_dos"
                        size="mini"
                        placeholder="频次"
                        @change="zongliang(scope.row, index)"
                      >
                        <el-option
                          v-for="item in thatF.pinci"
                          :key="item.name"
                          :label="item.name"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'usage'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.usage"
                        size="mini"
                        placeholder="用法"
                      >
                        <el-option
                          v-for="item in thatF.geiyao"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  v-else-if="item.prop == 'count'"
                  :width="item.width"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-input
                        v-model="scope.row.count"
                        size="mini"
                        placeholder="总量"
                         @blur="zongpicit(scope.row)"
                      ></el-input>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'is_skin_test'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-checkbox
                        v-model="scope.row.is_skin_test"
                      ></el-checkbox>
                    </span>
                  </template>
                  <!-- <template slot-scope="scope">
                    <span>
                      <el-checkbox
                        v-model="scope.row.is_skin_test"
                        :checkbox='scope.row.is_skin_test'
                      ></el-checkbox>
                    </span>
                  </template> -->
                </el-table-column>
                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'trans_speed'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <span>
                        <el-select
                          v-model="scope.row.trans_speed"
                          size="mini"
                          placeholder="滴速"
                        >
                          <el-option
                            v-for="item in thatF.disu"
                            :key="item.name"
                            :label="item.name"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                      </span>
                    </span>
                  </template>
                </el-table-column>
               <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'department_name'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                  ref="myCascader"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-cascader
                        v-model="scope.row.department_name"
                        :options="thatF.departmentoptions"
                        :props="{ label: 'name', value: 'name' }"
                        style="width: 90%"
                        size="mini"
                        :show-all-levels="false"
                      ></el-cascader>
                    </span>
                  </template>
                </el-table-column> -->
                <!-- <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'usage_extra'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <el-select
                        v-model="scope.row.usage_extra"
                        size="mini"
                        placeholder="西药脚注"
                      >
                        <el-option
                          v-for="item in thatF.xiyaojiaozhu"
                          :key="item.name"
                          :label="item.name"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                    </span>
                  </template>
                </el-table-column> -->

                <el-table-column
                  :width="item.width"
                  v-else-if="item.prop == 'remark'"
                  :prop="item.prop"
                  :fixed="item.left"
                  :label="item.label"
                  :key="index"
                >
                  <template slot-scope="scope">
                    <span>
                      <span>
                        <el-input
                          v-model="scope.row.remark"
                          size="mini"
                          placeholder="备注"
                        ></el-input>
                      </span>
                    </span>
                  </template>
                </el-table-column>

                <el-table-column
                  :width="item.width"
                  v-else
                  :fixed="item.left"
                  :prop="item.prop"
                  :label="item.label"
                  :key="index"
                >
                </el-table-column>
              </template>

              <el-table-column fixed="right" label="操作" width="120">
                <template slot-scope="scope">
                  <el-button
                    @click.native.prevent="deleteRow(scope.$index, tableData2)"
                    type="text"
                    size="small"
                  >
                    移除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="医嘱离院" name="two">
          <div class="selects">
            <div class="selectTables" style="">
              <el-button
                type="success"
                slot="append"
                style="margin: 50px"
                @click="binglilogdeposit = true"
              >
                医嘱离院
              </el-button>
               <el-button
                type="success"
                slot="append"
                style="margin: 50px"
                @click="backOffDoctorStopAllAdvice"
              >
                撤销医嘱离院
              </el-button>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div>
        <!-- <viewTitle text="医嘱记录" style="font-size:20px;margin-bottom:20px" />
        <el-table :data="tableData"  style="width: 100%" height='200'>
          <template v-for="(item, index) in tableTitle1">

            <el-table-column
              :width="item.width"
          
              :prop="item.prop"
      
              :label="item.label"
              :key="index"
            >
            </el-table-column>
          </template>

        </el-table> -->
      </div>
      <el-dialog
        title="历史医嘱"
        :modal="false"
        :visible.sync="yizhutongbu"
        width="70%"
      >
        <el-form :inline="true" class="demo-form-inline" v-model="formInline">
          <el-form-item label="搜索">
            <el-input
              placeholder="请输入姓名/门诊号/身份证号"
              v-model="formInline.rightKeyValue"
              clearable
              @change="radiochang"
              size="small"
            >
              <el-button
                type="success"
                slot="append"
                icon="el-icon-search"
                @click="radiochang"
              >
                查询
              </el-button>
            </el-input>
          </el-form-item>
          <el-form-item label="当天入院">
            <el-checkbox
              v-model="formInline.today"
              @change="radiochang"
            ></el-checkbox>
          </el-form-item>

          <el-form-item label="类型">
            <el-select
              v-model="formInline.rightRadio"
              @change="radiochang"
              multiple
              placeholder="类型"
              size="small"
            >
              <el-option
                v-for="item in Radiooptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="范围">
            <el-select
              v-model="formInline.range"
              @change="radiochang"
              placeholder="范围"
              size="small"
            >
              <el-option
                v-for="item in Radiooptions2"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>

        <el-table
          :data="patientlist"
          style="width: 100%"
          @row-click="rowClick"
          highlight-current-row
          :row-class-name="tableRowClassName"
        >
          <el-table-column type="index" width="50"> </el-table-column>
          <el-table-column
            prop="room_name"
            :show-overflow-tooltip="true"
            width="200"
            label="房间-床位"
          >
            <!-- <template slot-scope="scope">
              {{ scope.row.room_name}}
            </template> -->

            <!-- </template> -->
          </el-table-column>

          <el-table-column prop="status" label="状态">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status == 1">待入院</el-tag>
              <el-tag v-if="scope.row.status == 2" type="success">在院</el-tag>
              <el-tag v-if="scope.row.status == 3" type="warning"
                >申请出院</el-tag
              >
              <el-tag v-if="scope.row.status == 4" type="info">待出院</el-tag>
              <el-tag v-if="scope.row.status == 5" type="danger">已出院</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="member.name" label="姓名"> </el-table-column>
          <!-- <el-table-column prop="member.psn_no" width="250" label="人员编号">
          </el-table-column> -->
          <el-table-column
            prop="member.insutype"
            :show-overflow-tooltip="true"
            label="险种类型"
          >
          </el-table-column>
          <el-table-column prop="med_type" width="150" label="医疗类别">
          </el-table-column>

          <el-table-column prop="member.gender" label="性别"> </el-table-column>
          <el-table-column prop="member.age" label="年龄"> </el-table-column>
          <el-table-column prop="memberNature" label="病人性质">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.memberNature == '医保'">{{
                scope.row.memberNature
              }}</el-tag>
              <el-tag v-if="scope.row.memberNature == '自费'" type="success">{{
                scope.row.memberNature
              }}</el-tag>
              <el-tag v-if="scope.row.memberNature == '农保'" type="warning">{{
                scope.row.memberNature
              }}</el-tag>
            </template>
          </el-table-column>

          <el-table-column
            prop="begntime"
            :show-overflow-tooltip="true"
            label="创建时间"
          >
          </el-table-column>
        </el-table>
        <viewTitle
          text="医嘱记录"
          style="font-size: 20px; margin-bottom: 20px"
        />
        <el-table
          :data="tableData3"
          style="width: 100%"
          height="200"
          ref="multipleTable4"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55"> </el-table-column>
          <template v-for="(item, index) in tableTitle2">
            <el-table-column
              :width="item.width"
              :prop="item.prop"
              :label="item.label"
              :key="index"
            >
            </el-table-column>
          </template>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <el-button @click="yizhutongbu = false">取 消</el-button>
          <el-button type="success" @click="handelMemberSave">保 存</el-button>
        </div>
      </el-dialog>
      <el-dialog
        :close-on-click-modal="false"
        :modal="false"
        center
        title="确认时间"
        :visible.sync="binglilogdeposit"
        width="30%"
      >
        <el-col :span="24">
          <div class="block">
            <el-date-picker
              v-model="times"
              type="datetime"
              size="mini"
              placeholder="选择日期时间"
              style="width: 200px"
              value-format="yyyy-MM-dd HH:mm:ss"
            >
            </el-date-picker>
          </div>
        </el-col>
        <div slot="footer" class="dialog-footer" style="margintop: 30px">
          <el-button @click="binglilogdeposit = false">取 消</el-button>
          <el-button type="success" @click="getdoctorStopAllAdvice"
            >确 定</el-button
          >
        </div>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import { getIndex } from "@/api/account";
import {
  getAdviceList,
  getHospitalMember,
  doctorStopAllAdvice,
  backOffDoctorStopAllAdvice
} from "@/api/zhuyanre";

import ViewTitle from "@/forComponents/viewTitle";
export default {
  props: ["selectParams", "selectData", "thatF", "id"],

  data() {
    return {
      threeSelectLoading: false,
      tabIndex: "three",
      params: {},
      search: "",
      two_select_data: [],
      remark: "",
      isCollapse: 1,

      //科室
      departmentoptions: [],
      //
      // typelist:[
      //   {id:1,name:'西药'}
      // ],
      tableTitle: [
        {
          prop: "id",
          label: "序号",
          left: "left",
          width: "50",
        },
          {
           prop: "id2",
          label: "成组",
          left: "left",
          width: "50",
        },
        //  {
        //   prop: "fill_no",
        //   label: "批号"
        // },
        {
          prop: "typename",
          label: "类型",
          left: "left",
          width: "50",
        },
        // {
        //   prop: "is_own",
        //   label: "自备",
        //   left: "left",
        //   width: "50",
        // },
        {
          prop: "start_time",
          label: "开始时间",
          width: "250",
          left: "left",
        },
        {
          prop: "name",
          label: "医嘱内容",
          width: "150",
          left: "left",
        },
        {
          prop: "specification",
          label: "规格",
          width: "100",
        },
        {
          prop: "dose",
          label: "一次剂量",
        },
        {
          prop: "dose_unit",
          label: "剂量单位",
          width: "80",
        },
        {
          prop: "usage",
          label: "用法",
          width: "100",
        },
        {
          prop: "each_dos",
          label: "频次",
          width: "150",
        },

        {
          prop: "count",
          label: "总用量",
        },
        {
          prop: "base_unit",
          label: "基本单位",
          width: "150",
        },

        //   {
        //   prop: "fee_category_id",
        //   label: "费用类型",
        //   width:"150"
        // },
        {
          prop: "price",
          label: "价格",
        },
        {
          prop: "end_time",
          label: "结束时间",
          width: "250",
        },

        {
          prop: "is_skin_test",
          label: "皮试",
        },
        {
          prop: "trans_speed",
          label: "滴速",
          width: "150",
        },
        {
          prop: "remark",
          label: "开立备注",
          width: "150",
        },
        // {
        //   prop: "department_name",
        //   label: "执行部门",
        //   width: "150",
        // },
        // {
        //   prop: "usage_extra",
        //   label: "西药脚注",
        //   width: "150",
        // },
        {
          prop: "num",
          label: "库存数量",
        },
      ],
      tableTitle1: [
        {
          prop: "id",
          label: "序号",
        },
         
        {
          prop: "source",
          label: "来源",
        },
        {
          prop: "typename",
          label: "医嘱项类型",
          width: "100",
        },
        // '1西药2中药3检验4检查5手术6治疗'
        {
          prop: "type",
          label: "医嘱类型",
        },
        {
          prop: "dose",
          label: "一次剂量",
        },
        {
          prop: "dose_unit",
          label: "剂量单位",
        },
        {
          prop: "used_frqu",
          label: "频次",
          width: "150",
        },
        {
          prop: "usage",
          label: "用法",
          width: "150",
        },
        {
          prop: "number",
          label: "总用量",
        },
        {
          prop: "base_unit",
          label: "基本单位",
        },
        {
          prop: "fee_category_name",
          label: "费用类型",
          width: 150,
        },

        {
          prop: "business_name",
          label: "医嘱内容",
          width: "150",
        },
        {
          prop: "specification",
          label: "规格",
          width: "150",
        },

        {
          prop: "start_time",
          label: "开始时间",
          width: "210",
        },
        {
          prop: "end_time",
          label: "结束时间",
          width: "200",
        },

        {
          prop: "price",
          label: "费用",
        },

        {
          prop: "total",
          label: "总价",
        },

        {
          prop: "skin_test",
          label: "皮试",
        },
        {
          prop: "drip_speed",
          label: "滴速",
          width: "150",
        },
        {
          prop: "remark",
          label: "开立备注",
          width: "150",
        },
        {
          prop: "status",
          label: "医嘱状态",
          width: "150",
        },
        // {
        //   prop: "dept.name",
        //   label: "执行部门",
        //   width: "150",
        // },

        {
          prop: "jiaozhu",
          label: "西药脚注",
          width: "150",
        },
        {
          prop: "num",
          label: "库存数量",
        },
      ],
      tableTitle2: [

        {
          prop: "id",
          label: "序号",
        },
       {
          prop: "id2",
          label: "成组",
        },
        {
          prop: "source",
          label: "来源",
        },
        {
          prop: "typename",
          label: "医嘱项类型",
          width: "100",
        },
        {
          prop: "business_name",
          label: "医嘱内容",
          width: "150",
        },
        // '1西药2中药3检验4检查5手术6治疗'
        {
          prop: "type",
          label: "医嘱类型",
        },
        {
          prop: "dose",
          label: "剂量",
        },
        {
          prop: "dose_unit",
          label: "计量单位",
        },
        {
          prop: "number",
          label: "数量",
        },
        {
          prop: "base_unit",
          label: "基本单位",
        },
        {
          prop: "fee_category_name",
          label: "费用类型",
          width: 150,
        },


        {
          prop: "specification",
          label: "规格",
          width: "150",
        },

        {
          prop: "start_time",
          label: "开始时间",
          width: "200",
        },
        {
          prop: "end_time",
          label: "结束时间",
          width: "200",
        },
        {
          prop: "used_frqu",
          label: "频次",
          width: "150",
        },
        {
          prop: "usage",
          label: "用法",
          width: "150",
        },

        {
          prop: "price",
          label: "费用",
        },

        {
          prop: "total",
          label: "总价",
        },

        {
          prop: "skin_test",
          label: "皮试",
        },
        {
          prop: "drip_speed",
          label: "滴速",
          width: "150",
        },
        {
          prop: "remark",
          label: "开立备注",
          width: "150",
        },
        {
          prop: "status",
          label: "医嘱状态",
          width: "150",
        },
        // {
        //   prop: "dept.name",
        //   label: "执行部门",
        //   width: "150",
        // },

        {
          prop: "jiaozhu",
          label: "西药脚注",
          width: "150",
        },
        {
          prop: "num",
          label: "库存数量",
        },
      ],
      tableData1: [],
      tableData2: [],
      tableData: [],
      formusername2: "",
      doctor_id: "",
      visiblePatient2: false,
      yizhutongbu: false,
      duserlist: [],

      Radiooptions: [
        {
          value: "1",
          label: "待入院",
        },
        {
          value: "2",
          label: "在院",
        },
        {
          value: "3",
          label: "申请出院",
        },
        {
          value: "4",
          label: "待出院",
        },
        {
          value: "5",
          label: "已出院",
        },
      ],
      Radiooptions2: [
        {
          value: "1",
          label: "个人",
        },
        {
          value: "2",
          label: "科室",
        },
        { value: "3", label: "全院" },
      ],
      formInline: {
        rightKeyValue: "",
        rightRadio: ["2"],
        range: "3",
        today: false,
        page: 1,
        limit: 5,
        icu_id: "",
        nature: "",
      },
      patientlist: [],
      tableData3: [],
      multipleSelection: [],
      selectData10: [
        {
          name: "",
          remark: "",
        },
      ],
      tableTitle10: [
        {
          prop: "name",
          label: "医嘱内容",
        },

        {
          prop: "remark",
          label: "备注",
        },
        {
          prop: "caozuo",
          label: "添加",
        },
      ],
      tableTitle11: [
        {
          prop: "id",
          label: "序号",
        },
        {
          prop: "title",
          label: "标题",
        },

        {
          prop: "remark",
          label: "备注",
        },
        {
          prop: "caozuo",
          label: "添加",
        },
      ],
      binglilogdeposit: false,
      times: "",
      multipleSelection2:'',
      rowSelectFlag:true
      // patientid:'',
    };
  },

  mounted() {
    this.getIndex();
    console.log(this.id);
    var arr = JSON.parse(localStorage.getItem("userInfo"));
    this.doctor_id = arr.id;
    this.formusername2 = arr.real_name;
    this.getAdviceList(this.id);
  },
  watch: {
    id(no) {
      this.getAdviceList(no);
    },
    isCollapse(no) {
      this.getDrugItem();
    },
  },
  methods: {
    radiochang(val) {
      console.log(val);
      this.getHospitalMember();
    },
    zongliang(row, i) {
      console.log(row)
      if (row.type == 1) {
        console.log(row);
        var pcnum = this.matching2(row.each_dos);
        var pcnum2 = 1;
        if (isNaN(parseFloat(pcnum))) {
        } else {
          pcnum2 = parseFloat(pcnum);
        }
        var dose = parseFloat(row.dose);
        var dose_base = parseFloat(row.dose_base);
        console.log(typeof parseFloat(pcnum));
        if (parseFloat(Math.round((pcnum2 * dose) / dose_base)) < 1) {
          row.count = 1;
        } else {
          console.log(pcnum2 * dose)
          
          row.count = parseFloat(Math.round((pcnum2 * dose) / dose_base));
          row.price = (parseFloat(row.count) * parseFloat(row.price1)).toFixed(
            3
          );
        }
      }
      console.log(row.count);
      //  this.tableData1[i]=row
    },
    zongpicit(row){
      console.log(row)
        row.price = (parseFloat(row.count) * parseFloat(row.price1)).toFixed(
            3
          );
    },
    getHospitalMember() {
      var that = this;
      let data_t = {
        ipt_no: "",
        m_keyword: that.formInline.rightKeyValue,
        icu_id: "",
        bed: "",
        status: that.formInline.rightRadio.toString(),
        doctor_id: "",
        nurse_id: "",
        dept_id: "",
        nature: that.formInline.nature,
        today: that.formInline.today ? 1 : "",
        range: that.formInline.range,
        page: that.formInline.page,
        limit: that.formInline.limit,
      };
      getHospitalMember(data_t)
        .then((res) => {
          let data = res.data.list;
          that.total = res.data.count;
          that.data_info = res.data;
          that.patientlist = [];
          if (data.length != 0) {
            that.patientlist = data;

            // that.patientid = data[0].id;
            // that.$refs.userinfn.readHospitalMemberDetail(patientinfo.id)
          }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    handelMemberSave() {
      console.log(this.multipleSelection);
         let yy = new Date().getFullYear();
      let mm = new Date().getMonth() + 1;
      let dd = new Date().getDate();
      let hh = new Date().getHours();
      let mf =
        new Date().getMinutes() < 10
          ? "0" + new Date().getMinutes()
          : new Date().getMinutes();
          var arr=[]
          for(var i in this.tableData3){
        for (let t = 0; t < this.multipleSelection.length; t++) {
          if(this.multipleSelection[t].is_group!=null&&this.multipleSelection[t].is_group!=0){
         if(this.tableData3[i].is_group==this.multipleSelection[t].is_group){
          arr.push(this.tableData3[i])
         }
        }
          }
      }

     this.multipleSelection=this.unique( this.multipleSelection.concat(JSON.parse(JSON.stringify(arr))))
      for (let i = 0; i < this.multipleSelection.length; i++) {
        this.multipleSelection[i].name =
          this.multipleSelection[i].business_name;
       
        // this.multipleSelection[i].typename=this.multipleSelection[i].type
        // this.multipleSelection[i].type=this.multipleSelection[i].type=='西药'?1:
        // this.multipleSelection[i].type=='项目'?8:this.multipleSelection[i].type=='检查'?4:
        // this.multipleSelection[i].type=='检验'?3:this.multipleSelection[i].type=='治疗'?6:this.multipleSelection[i].type=='自带药'?10:
        //     this.multipleSelection[i].type=='医嘱术语'?7:this.multipleSelection[i].type=='出院带药'?7:''
         this.multipleSelection[i].price1 = this.multipleSelection[i].dose_price
        this.multipleSelection[i].count = this.multipleSelection[i].number;
        this.multipleSelection[i].is_skin_test =
          this.multipleSelection[i].skin_test == "皮试" ? true : false;
        if (this.multipleSelection[i].fee_category_id < 10) {
          this.multipleSelection[i].fee_category_id =
            "0" + this.multipleSelection[i].fee_category_id;
        } else {
          this.multipleSelection[i].fee_category_id =
            this.multipleSelection[i].fee_category_id;
        }
        this.multipleSelection[i].id = this.multipleSelection[i].business_id;
         this.multipleSelection[i].start_time = yy + "-" + mm + "-" + dd + " " + hh + ":" + mf;
      
  
      
      }
     
      this.tableData1 = this.tableData1.concat(JSON.parse(JSON.stringify(this.multipleSelection)));
      console.log(this.tableData1);
      // this.chengzu()
      this.yizhutongbu = false;
    },
    unique(arr) {
  const res = new Map();
  return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
},
    handleSelectionChange(val) {
      console.log(val);
   
   
    this.multipleSelection = val;

         
    
       
    },
    toggleSelection(rows) {
        setTimeout(() => {
         this.rowSelectFlag = true
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable4.toggleRowSelection(row);
          });
            this.rowSelectFlag = false
        } else {
          this.$refs.multipleTable4.clearSelection();
        }
      
    }, 0)
      },
    handleSelectionChange2(val) {
      console.log(val);
      this.multipleSelection2 = val;
    },
    handleSelectionChange3(val) {
      console.log(val);
      this.multipleSelection3 = val;
    },
    chengzu(){
      var arr=Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
      +''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
      +''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
      if(this.multipleSelection2.length>1){
           for (let t = 0; t < this.multipleSelection2.length; t++) {
         if(this.multipleSelection2[t].type==this.multipleSelection2[this.multipleSelection2.length-1].type){
        for (let i = 0; i < this.tableData1.length; i++) {
        
          if(this.multipleSelection2[t].suiji==this.tableData1[i].suiji){
            this.tableData1[i].is_group=arr
          }
           
         }
          
        }else{
          this.$message('不同类型无法设置成组')
        }
        }
          this.multipleSelection2=[]
           this.$refs.multipleTable.clearSelection();
           this.$message({
              message: "设置成功",
              type: "success",
            });
      }else{
            this.$message('请最少选择两条医嘱')
      }
     
        console.log(this.tableData1)
        // for (let i = 0; i < this.tableData1.length; i++) {
        //     this.tableData1.sort(this.arraySort(parseInt(this.tableData1[i].is_group)))
          
        // }
        this.tableData1.sort(function(a,b){
          return a.is_group > b.is_group?1:-1 
        })
        this.tianjiaids()
    },

    tianjiaids(){
      for (let j = 0; j <  this.tableData1.length; j++) {
       
        if ( this.tableData1[j].is_group != null&& this.tableData1[j].is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.tableData1.length; i++) {
            if(this.tableData1[i].is_group==this.tableData1[j].is_group){
              arr.push(i)
            }
          }
          console.log(arr)
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.tableData1[arr[i]].id2='┌' 
          }else if (i==arr.length-1){
            this.tableData1[arr[arr.length-1]].id2='└' 
          }else{
            this.tableData1[arr[i]].id2='|' 
          }
        }
        }
      }
         
    },
    quxiaochengzu(){
         for (let i = 0; i < this.tableData1.length; i++) {
          this.tableData1[i].is_group=''
          this.tableData1[i].id2=''
          
        }
        this.$message({
           message: "已取消所有成组",
              type: "success",
        })
    },


    chengzu2(){
      var arr=Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
      +''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
      +''+Math.round(Math.random()*8)+''+Math.round(Math.random()*8)
        if(this.multipleSelection3.length>1){
       for (let t = 0; t < this.multipleSelection3.length; t++) {
         if(this.multipleSelection3[t].type==this.multipleSelection3[this.multipleSelection3.length-1].type){
        for (let i = 0; i < this.tableData2.length; i++) {
        
           if(this.multipleSelection3[t].suiji==this.tableData2[i].suiji){
            this.tableData2[i].is_group=arr
          }
         }
          
        }else{
          this.$message('不同类型无法设置成组')
        }
        }
          
           this.$refs.multipleTable2.clearSelection();
           this.$message({
              message: "设置成功",
              type: "success",
            });
      }else{
            this.$message('请最少选择两条医嘱')
      }
         this.tableData2.sort(function(a,b){
          return a.is_group > b.is_group?1:-1 
        })

        this.tianjiaids2()

    },
    tianjiaids2(){
      for (let j = 0; j <  this.tableData2.length; j++) {
       
        if ( this.tableData2[j].is_group != null&& this.tableData2[j].is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.tableData2.length; i++) {
            if(this.tableData2[i].is_group==this.tableData2[j].is_group){
              arr.push(i)
            }
          }
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.tableData2[arr[i]].id2='┌' 
          }else if (i==arr.length-1){
            this.tableData2[arr[arr.length-1]].id2='└' 
          }else{
            this.tableData2[arr[i]].id2='|' 
          }
        }
        }
      }
         
    },
     quxiaochengzu2(){
         for (let i = 0; i < this.tableData2.length; i++) {
          this.tableData2[i].is_group=''
          this.tableData1[i].id2=''
        }
        this.$message({
           message: "已取消所有成组",
              type: "success",
        })
    },
    selectedstyle({ row, rowIndex }) {
      if (this.getIndex2 === rowIndex) {
        return {
          "background-color": "#85ce61",
        };
      }
    },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    rowClick(row, rowIndex) {
      console.log(row);
      this.getIndex2 = rowIndex;
      // this.patientid=row.id
      this.getAdviceList2(row.id);
    },
    getIndex() {
      var data_y = {
        user_type: 2,
        page: 1,
        limit: 3000,
        //  status:1
      };

      getIndex(data_y)
        .then((res) => {
          this.duserlist = res.data.list;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    //选择处方医生
    xuanzePatient2(item) {
      console.log("item", item);
      this.formusername2 = item.real_name;
      this.doctor_id = item.id;
      this.visiblePatient2 = false;
    },
    //获取医嘱列表
    getAdviceList(e) {
      var data = {
        hospital_id: e,
        time_type: this.tabIndex == "three" ? "1" : "2",
      };
      getAdviceList(data).then((res) => {
        if (res.code == 200) {
          this.tableData = res.data.list;
          for (let i in this.tableData) {
            this.tableData[i].source =
              this.tableData[i].source == 1 ? "医生" : "护士";
           
            this.tableData[i].advice_type =
              this.tableData[i].advice_type == 1 ? "项目" : "药品";
            this.tableData[i].dose_unit2 =
              this.tableData[i].dose + "" + this.tableData[i].dose_unit;
           
            this.tableData[i].result2 =
              this.tableData[i].skin_result == 1
                ? "(-)"
                : this.tableData[i].skin_result == 2
                ? "(+)"
                : "";
            this.tableData[i].number2 =
              this.tableData[i].number + "" + this.tableData[i].unit;
            this.tableData[i].time_type =
              this.tableData[i].time_type == 1 ? "长期" : "临时";
            this.tableData[i].typename =
              this.tableData[i].type === 1
                ? "西药"
                : this.tableData[i].type === 2
                ? "中药"
                : this.tableData[i].type === 3
                ? "检验"
                : this.tableData[i].type === 4
                ? "检查"
                : this.tableData[i].type === 5
                ? "手术"
                : this.tableData[i].type === 10
                ? "自带药"
                : this.tableData[i].type === 11
                ? "量表"
                : this.tableData[i].type === 7
                ? "医嘱术语"
                : this.tableData[i].type === 9
                ? "出院带药"
                : "治疗";
            this.tableData[i].advice_status =
              this.tableData[i].advice_status == 1 ? "待执行" : "已执行";
            this.tableData[i].skin_test =
              this.tableData[i].skin_test == 1 ? "皮试" : "继用";
            this.tableData[i].check_type =
              this.tableData[i].check_type == 1
                ? "通过"
                : this.tableData[i].check_type == 2
                ? "未通过"
                : "不通过";
            this.tableData[i].status =
              this.tableData[i].status == 1
                ? "草稿"
                : this.tableData[i].status == 2
                ? "提交"
                : this.tableData[i].status == 3
                ? "校对"
                : this.tableData[i].status == 4
                ? "完成"
                : this.tableData[i].status == 5
                ? "待停止"
                : this.tableData[i].status == 6
                ? "已停止"
                : "废除";

            //低速
            this.tableData[i].drip_speed = this.matching(
              this.tableData[i].drip_speed,
              1
            );
            this.tableData[i].used_frqu = this.matching(
              this.tableData[i].used_frqu,
              2
            );
            this.tableData[i].usage = this.matching(this.tableData[i].usage, 3);
            this.tableData[i].jiaozhu = this.matching(
              this.tableData[i].jiaozhu,
              4
            );
          }
        }
      });
    },
    getAdviceList2(e) {
      var data = {
        hospital_id: e,
        time_type: this.tabIndex == "three" ? "1" : "2",
         limit:1000
      };
      getAdviceList(data).then((res) => {
        if (res.code == 200) {
          this.tableData3 = res.data.list;
          console.log(res);
          for (let i in this.tableData3) {
            this.tableData3[i].source =
              this.tableData3[i].source == 1 ? "医生" : "护士";
        
            this.tableData3[i].advice_type =
              this.tableData3[i].advice_type == 1 ? "项目" : "药品";
            this.tableData3[i].dose_unit2 =
              this.tableData3[i].dose + "" + this.tableData3[i].dose_unit;
           
      
            this.tableData3[i].result2 =
              this.tableData3[i].skin_result == 1
                ? "(-)"
                : this.tableData3[i].skin_result == 2
                ? "(+)"
                : "";
            this.tableData3[i].number2 =
              this.tableData3[i].number + "" + this.tableData3[i].unit;
            this.tableData3[i].time_type =
              this.tableData3[i].time_type == 1 ? "长期" : "临时";
            this.tableData3[i].typename =
              this.tableData3[i].type === 1
                ? "西药"
                : this.tableData3[i].type === 2
                ? "中药"
                : this.tableData3[i].type === 3
                ? "检验"
                : this.tableData3[i].type === 4
                ? "检查"
                : this.tableData3[i].type === 5
                ? "手术"
                : this.tableData3[i].type === 10
                ? "自带药"
                 : this.tableData3[i].type === 11
                ? "量表"
                : this.tableData3[i].type === 7
                ? "医嘱术语"
                : this.tableData3[i].type === 9
                ? "出院带药"
                : "治疗";
            this.tableData3[i].advice_status =
              this.tableData3[i].advice_status == 1 ? "待执行" : "已执行";
            this.tableData3[i].skin_test =
              this.tableData3[i].skin_test == 1 ? "皮试" : "继用";
            this.tableData3[i].check_type =
              this.tableData3[i].check_type == 1
                ? "通过"
                : this.tableData3[i].check_type == 2
                ? "未通过"
                : "不通过";
            this.tableData3[i].status =
              this.tableData3[i].status == 1
                ? "草稿"
                : this.tableData3[i].status == 2
                ? "提交"
                : this.tableData3[i].status == 3
                ? "校对"
                : this.tableData3[i].status == 4
                ? "完成"
                : this.tableData3[i].status == 5
                ? "待停止"
                : this.tableData3[i].status == 6
                ? "已停止"
                : "废除";
                  if (this.tableData3[i].is_group != null&&this.tableData[i].is_group!=0) {
         var  arr=[]
         for (let j = 0; j < this.tableData3.length; j++) {
            if(this.tableData3[j].is_group==this.tableData3[i].is_group){
              arr.push(j)
            
            
          }
        for (let t = 0; t < arr.length; t++) {
          if(t==0){
                 this.tableData3[arr[t]].id2='┌' 
          }else if (t==arr.length-1){
            this.tableData3[arr[arr.length-1]].id2='└' 
          }else{
            this.tableData3[arr[t]].id2='|' 
          }
         
          
        }         }
   
    
             

        }
            //低速
            //   this.tableData3[i].drip_speed = this.matching(
            //   this.tableData3[i].drip_speed,1
            // );
            //    this.tableData3[i].used_frqu = this.matching(
            //   this.tableData3[i].used_frqu,2
            // );
            //    this.tableData3[i].usage = this.matching(
            //   this.tableData3[i].usage,3
            // );
            //    this.tableData3[i].jiaozhu = this.matching(
            //   this.tableData3[i].jiaozhu,4
            // );
          }
        }
      });
    },
    //匹配
    matching2(arr) {
      var that = this;
      var art = 1;
      //  console.log(art,that.thatF.pinci)
      for (var i in that.thatF.pinci) {
        if (that.thatF.pinci[i].id == arr) {
          art = that.thatF.pinci[i].number;
          return art;
        }
      }
    },
    matching(arr, i) {
      var art = "";
      var that = this;
      switch (i) {
        case 1:
          for (var i in that.thatF.disu) {
            if (that.thatF.disu[i].id == arr) {
              art = that.thatF.disu[i].name;
            }
            return art;
          }
          break;

        case 2:
          for (var i in that.thatF.pinci) {
            if (that.thatF.pinci[i].id == arr) {
              art = that.thatF.pinci[i].name;
            }
            return art;
          }
          break;
        case 3:
          for (var i in that.thatF.geiyao) {
            if (that.thatF.geiyao[i].id == arr) {
              art = that.thatF.geiyao[i].name;
            }
            return art;
          }
          break;
        case 4:
          for (var i in that.thatF.xiyaojiaozhu) {
            if (that.thatF.xiyaojiaozhu[i].id == arr) {
              art = that.thatF.xiyaojiaozhu[i].name;
            }
            console.log(that.thatF.xiyaojiaozhu);
            return art;
          }
          break;
      }
    },
    //科室列表

    kehsi(val) {
      console.log(val);
    },

    //保存
    createAdvice() {
      // this.$refs['myCascader'].change()
      console.log("tableData1222", this.tableData1);
      this.$emit(
        "createAdvice",
        this.tableData2,
        this.tableData1,
        this.remark,
        this.doctor_id
      );
    },

    getDrugItem() {
      this.threeSelectLoading = false;
      this.thatF.selectParams.page = 1;
      // if (this.tabIndex == "three") {
      if (this.isCollapse == 1) {
        this.$emit("getDrugItem");
      } else {
        this.$emit("getServiceItem", this.isCollapse);
      }

      // } else if (this.tabIndex == "four") {
      //      if (this.isCollapse==1) {
      //   this.$emit("getDrugItem");
      // }else{
      //      this.$emit('getServiceItem');
      // }
      // }
    },
    handlePagination(e) {
      this.threeSelectLoading = true;
      this.selectParams.page = e;

      if (this.tabIndex == "three") {
        this.$emit("getServiceItem", this.isCollapse);
        this.threeSelectLoading = false;
      } else if (this.tabIndex == "four") {
        this.$emit("getServiceItem", this.isCollapse);
        this.threeSelectLoading = false;
      }
    },
    hadejiancha() {
      this.selectParams.page = 1;
      this.$emit("getServiceItem", this.isCollapse);
    },
    deleteRow(index, rows) {
    rows.splice(index, 1);
    
      //  
    },
    xuanzeDatathree2(index, item) {
      if (index == 1) {
        for (let i in item) {
          // item.forEach(res=>{
                 this.xuanzeDatathree(item[i]);
          // })
         
        }
      } else {
        for (let i = 0; i < item.length; i++) {
          this.xuanzeDatafour(item[i]);
        }
      }
    },
    xuanzeDatathree(item) {
      console.log(item)
      if(this.tableData1.length!=0){
          item.start_time=this.tableData1[0].start_time
      }else{
        let date = new Date()
        let yyyy = date.getFullYear()
        let MM = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1)
        let dd = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()
        let HH = date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()
        let mm = date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes()
    var ss = date.getSeconds();
        let curDay = yyyy + '-' + MM + '-' + dd + 'T' + HH + ':' + mm+ ':' + ss;
      item.start_time=curDay
      }
      item.is_group=0
      item.id2=''
      item.suiji= new Date().getTime()
      item.remark=''
      item.price1 = item.price;
       if(this.isCollapse!=1){
          item.count=1
         item.dose=1
         item.base_unit=item.unit
       }
      if (this.isCollapse == 1) {
        item.price1 = item.dose_price;
        // if (item.fee_category_id<10) {
        //    item.fee_category_id='0'+ item.fee_category_id
        // }else{
        item.fee_category_id = item.fee_category_id;
        // }
        item.fee_category_name = item.fee_category.name;
        item.is_skin_test = item.is_skin_test == 1 ? true : false;
        item.each_dos = item.used_frqu.used_frqu_id;
        item.type = this.isCollapse;
        this.zongliang(item);
      } else if (this.isCollapse == 7) {
        item.type = 7;
        item.typename = "医嘱术语";
       
      } else if (this.isCollapse == 8){
        item.type = item.type==1?8:item.type == 2?4:
        item.type == 3?3:item.type == 4?6:item.type == 6?11:item.type;
      
        item.dose_unit = item.unit;
          item.fee_category_name = item.fee_category.name;
    
        item.is_skin_test = item.is_skin_test == 1 ? true : false;
       
        }else if (this.isCollapse == 11) {
        item.id = item.business_id;
        item.name = item.business_name;
        // item.price1 = item.dose_price;
        item.count = item.number;
        item.typename = item.typename;
        item.each_dos = item.used_frqu.used_frqu_id;
        item.type = item.type;
        // item.typename=item.type
      } else if (this.isCollapse == 12) {
        item.name = item.name;
        // item.price1 = item.price;
        item.type = item.type==1?8:item.type == 2?4:
        item.type == 3?3:item.type == 4?6:item.type == 6?11:item.type;
        item.count = 1;
         item.dose_unit = item.unit;
         
        item.typename = item.typename;
      } else if (this.isCollapse != 10) {
        console.log(item);
        item.fee_category_name = item.fee_category.name;
        if (item.fee_category_id < 10) {
          item.fee_category_id = "0" + item.fee_category_id;
        } else {
          item.fee_category_id = item.fee_category_id;
        }

        item.dose_unit = item.unit;
        item.type = this.isCollapse;
      }else if(this.isCollapse == 13){
         item.type = 11;
          item.typename = "量表";
      } else {
        item.type = 10;
        item.typename = "自备药";
     
        item.price1 = item.price;
        item.name=item.name+'(自备)'
      }
      item.dose_base = item.dose;
     
      
      this.tableData1 = this.tableData1.concat(
        JSON.parse(JSON.stringify(item))
      );
      this.threeSelectLoading = false;
    },
    shijian(item2,index){
      console.log(item2,index)
          // this.tableData2.forEach(item=>{
          //   item.start_time=item2
          // })
          for(let i in this.tableData2){
            if(i!=index){
            this.tableData2[i].start_time=item2
            }
          }
          this.$set(this.tableData2,this.tableData2)
    },
       shijian2(item2,index){
          console.log(item2,index)
        
          for(let i in this.tableData1){
            if(i!=index){
                   this.tableData1[i].start_time=item2
            }
           
          }
          this.$set(this.tableData1,this.tableData1)
    },
    xuanzeDatafour(item) {
          if(this.tableData2.length!=0){
          item.start_time=this.tableData2[0].start_time
      }else{
        let date = new Date()
        let yyyy = date.getFullYear()
        let MM = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1)
        let dd = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()
        let HH = date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()
        let mm = date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes()
    var ss = date.getSeconds();
        let curDay = yyyy + '-' + MM + '-' + dd + 'T' + HH + ':' + mm+ ':' + ss;
      item.start_time=curDay
      }
      
      item.is_group=0
       item.id2=''
        item.remark=''
        item.price1 = item.price;
       item.suiji=new Date().getTime()
           if(this.isCollapse!=1&&this.isCollapse!=9){
          item.count=1
         item.dose=1
         item.base_unit=item.unit
       }

      if (this.isCollapse == 1) {
      item.price1 = item.dose_price;
        console.log(item.fee_category);
        // if (item.fee_category_id<10) {
        //    item.fee_category_id='0'+ item.fee_category_id
        // }else{
        //    item.fee_category_id=item.fee_category_id
        // }
        item.fee_category_name = item.fee_category.name;

        item.is_skin_test = item.is_skin_test == 1 ? true : false;
        item.each_dos = item.used_frqu.id;
        item.type = this.isCollapse;
        this.zongliang(item);
      } else if (this.isCollapse == 7) {
        item.type = 7;
        item.typename = "医嘱术语";
      }  else if (this.isCollapse == 8){
      item.type = item.type==1?8:item.type == 2?4:
        item.type == 3?3:item.type == 4?6:item.type == 6?11:item.type;
        item.dose_unit = item.unit;
      item.fee_category_name = item.fee_category.name;

        item.is_skin_test = item.is_skin_test == 1 ? true : false;

       
        }else if (this.isCollapse == 11) {
        item.id = item.business_id;
        item.name = item.business_name;
       
        item.count = item.number;
        // item.typename=item.typename
        item.each_dos = item.used_frqu.used_frqu_id;

        item.type = item.type;
        console.log(item.type, "000000");
      } else if (this.isCollapse == 12) {
        item.name = item.name;
        // item.price1 = item.price;
        item.count = 1;
        item.type = item.type==1?8:item.type == 2?4:
        item.type == 3?3:item.type == 4?6:item.type == 6?11:item.type;
     
       
      }else if(this.isCollapse == 13){
         item.type = 11;
          item.typename = "量表";
      }else if(this.isCollapse==10){
        item.type = 10;
        item.typename = "自备药";
     
     
        item.name=item.name+'(自备)'
      }  else {
        console.log(item);
        if (item.fee_category_id < 10) {
          item.fee_category_id = "0" + item.fee_category_id;
        } else {
          item.fee_category_id = item.fee_category_id;
        }
        item.fee_category_name = item.fee_category.name;
        item.dose_unit = item.unit;
        item.type = this.isCollapse;
      }
      item.dose_base = item.dose;
    
      console.log("00000");
      this.tableData2 = this.tableData2.concat(
        JSON.parse(JSON.stringify(item))
      );
      this.threeSelectLoading = false;
    },

    handleClick(e) {
      // this.tabIndex=e
      //      console.log(e)
      if (this.tabIndex == "three") {
        this.getAdviceList(this.id);
        this.$emit("getDrugItem");
        console.log(e);
      } else if (this.tabIndex == "four") {
        this.getAdviceList(this.id);
        this.$emit("getDrugItem");
        console.log(e);
      } else if (this.tabIndex == "two") {
      }
    },
    backOffDoctorStopAllAdvice(){
        
         this.$confirm("是否确定撤销离院", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      }).then(() => {
        backOffDoctorStopAllAdvice({
          hospital_id: this.id,
      
        }).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "撤销离院成功",
              type: "success",
            });
       
          }
        });
      });
    },
    getdoctorStopAllAdvice() {
      this.$confirm("是否确定离院", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      }).then(() => {
        doctorStopAllAdvice({
          hospital_id: this.id,
          stop_time: this.times,
        }).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "离院成功",
              type: "success",
            });
            this.binglilogdeposit = false;
          }
        });
      });
    },
    cleardata() {
      this.tableData1 = [];
      this.tableData2 = [];
    },
  },
  components: { ViewTitle },
};
</script>
<style lang='scss' scoped>
.yisheng {
  width: 300px;
  float: left;
  height: 50px;
  margin-left: 10px;
}
.userinfo {
  display: flex;
  align-items: center;
  border: 1px solid #e7e7e7;
  padding-left: 30px;
  line-height: 60px;
  border-radius: 20px;
  margin-bottom: 20px;
  > div {
    flex: 1;
  }
}
.buts {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.selects {
  position: relative;
  // /deep/ .el-input{
  //   width: 300px;
  // }

  .selectTables {
    width: 600px;
  }
}
input[type=datetime-local]{
  width: 240px;
}
</style>